package cn.itsource.crm.web.util;

import cn.itsource.crm.domain.MyUser;
import org.apache.shiro.SecurityUtils;

/**
 * 该工具类是专门用来存取session中的值
 */
public class UserContext {
    public static final String USER_IN_SESSION = "user_in_session";
    public static void setSession(MyUser employee){
        SecurityUtils.getSubject().getSession().setAttribute(USER_IN_SESSION, employee);
    }

    public static MyUser getCurrentUser(){
        return (MyUser) SecurityUtils.getSubject().getSession().getAttribute(USER_IN_SESSION);
    }
}
